#include "UdpFilerServer.h"
#include "ui_UdpFilerServer.h"

static QFile* file = nullptr;
UdpFilerServer::UdpFilerServer(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::UdpFilerServer)
{
    ui->setupUi(this);
    Init();
}

UdpFilerServer::~UdpFilerServer()
{
    delete ui;
}

void UdpFilerServer::Init()
{
    m_pServer = new QUdpSocket();
    m_pServer->bind(8090);
    connect(m_pServer,&QUdpSocket::readyRead,this,&UdpFilerServer::readSocket);
}

void UdpFilerServer::startProcess()
{

}

void UdpFilerServer::readSocket()
{
    while (m_pServer->hasPendingDatagrams())
    {
        qint64 iFileSize= m_pServer->pendingDatagramSize();
        QByteArray buf;
        m_pServer->readDatagram(buf.data(),iFileSize);

    }
}
